function checkdata() {
	if(!checkPassWord(changepwd.pwd.value)) return false;
	if(!checkNewPassWord(changepwd.newpwd.value)) return false;
	if(!checkNewPassWord2(changepwd.newpwd2.value)) return false;
return true;
}

function checkPassWord(pw) {
	if( strlen(changepwd.pwd.value)<3 || strlen(changepwd.pwd.value)>40 ) {
		//alert("\正确地登录密码长度为3～40位，仅可用英文、数字、特殊字符！");
		document.getElementById("passwordErr").innerHTML = "<font color = 'red'>Old Password's length is 3 to 40！</font>";
		changepassword.password.focus();
		return false;
		}

		if( strlen2(changepwd.newpwd.value) ) {
			//alert("\您的密码中包含了非法字符，仅可用英文、数字、特殊字符！");
			document.getElementById("passwordErr").innerHTML = "<font color = 'red'>Old Password contains illegal characters!</font>";
			changepassword.newpassword.focus();
			return false;
		}
		document.getElementById("passwordErr").innerHTML = "";
		return true;
}

function checkNewPassWord(npw) {
	if( changepwd.pwd.value == changepwd.newpwd.value ) {
		//alert("\舊密码和新密碼不能相同！");
		document.getElementById("newpasswordErr").innerHTML = "<font color = 'red'>Old Password and New Password cannot be same！</font>";
		changepassword.newpassword.focus();
		return false;
	}
	if( strlen(changepwd.newpwd.value)<3 || strlen(changepwd.newpwd.value)>40 ) {
		//alert("\正确地登录新密码长度为3～40位，仅可用英文、数字、特殊字符！");
		document.getElementById("newpasswordErr").innerHTML = "<font color = 'red'>New Password's length is 3 to 40</font>";
		changepassword.newpassword.focus();
		return false;
		}
	document.getElementById("newpasswordErr").innerHTML = "";
	return true;
}
	
function checkNewPassWord2(npw2) {
	if( changepwd.newpwd2.value =="" ) {
		//alert("\请输入密码确认！");
		document.getElementById("newpassword2Err").innerHTML = "<font color = 'red'>Please input the Confirm Password！</font>";
		changepassword.newpassword2.focus();
		return false;
		}
		if( changepwd.newpwd2.value != changepwd.newpwd.value ) {
		//alert("\两次密码输入不一致！");
		document.getElementById("newpassword2Err").innerHTML = "<font color = 'red'>New Password and Confirm Password must be same！</font>";	
		changepassword.newpassword.focus();
		return false;
		}
		document.getElementById("newpassword2Err").innerHTML = "";	
		return true;
}

function strlen(str){
	var len;
	var i;
	len = 0;
	for (i=0;i<str.length;i++){
		if (str.charCodeAt(i)>255) len+=2; else len++;
	}
	return len;
}
	
function strlen2(str){
	var len;
	var i;
	len = 0;
	for (i=0;i<str.length;i++){
		if (str.charCodeAt(i)>255) return true;
	}
	return false;
}

function isWhiteWpace (s) {
	var whitespace = " \t\n\r";
	var i;
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (whitespace.indexOf(c) >= 0) {
			return true;
		}
	}
	return false;
}
	
function isSsnString (ssn) {
	var re=/^[0-9a-z][\w-.]*[0-9a-z]$/i;
	if(re.test(ssn))
		return true;
	else
		return false;
}


